package com.jichaoyun.model.app;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;


@Data
@DS("app")
@TableName("jcy_user")
public class AppUser implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.AUTO)
    @ExcelProperty(value = "id",index = 0)
    private Integer id;

    /**
     * 用户名
     */
    @ExcelProperty(value = "账号",index = 2)
    private String username;

    /**
     * 密码
     */
    @ExcelIgnore
    private String password;

    /**
     * 0普通用户1管理员2超级管理员
     */
    @ExcelIgnore
    private Integer userRole;

    @ExcelProperty(value = "角色",index = 4)
    @TableField(exist = false)
    private String userRoleStr;

    /**
     * 创建用户的id
     */
    @ExcelIgnore
    private Integer parentId;

    /**
     * 1删除0没删除
     */
    @TableLogic(value = "0",delval ="1")
    @ExcelIgnore
    private Integer deleted;

    /**
     * 公司名称
     */
    @ExcelProperty(value = "用户名",index = 1)
    private String companyName;

    /**
     * 创建时间
     */
    @ExcelProperty(value = "创建时间",index = 5)
    private Date createdTime;

    /**
     * 最近登陆时间
     */
    @ExcelProperty(value = "最近登录",index = 6)
    private LocalDateTime lastloginTime;

    /**
     * 金钱
     */
    @ExcelIgnore
    private BigDecimal balance;

    /**
     * 电话
     */
    @ExcelProperty(value = "手机",index = 7)
    private String tel;

    /**
     * 启动1禁用0
     */
    @ExcelProperty(value = "状态",index = 3)
    private Integer status;

    /**
     * 负责人姓名
     */
    @ExcelIgnore
    private String principal;

    /**
     * 0不可1可
     */
    @ExcelIgnore
    private Integer pwdChange;

    /**
     * 0not 1yes
     */
    @ExcelIgnore
    private Integer nameChange;

    @ExcelIgnore
    private String salt;

    /**
     * 令牌过期时间
     */
    @ExcelIgnore
    @TableField(exist = false)
    private LocalDateTime expireTime;


    @Override
    public String toString() {
        return "Customer{" +
                "id=" + id +
                ", username=" + username +
                ", password=" + password +
                ", userRole=" + userRole +
                ", parentId=" + parentId +
                ", deleted=" + deleted +
                ", companyName=" + companyName +
                ", createdTime=" + createdTime +
                ", lastloginTime=" + lastloginTime +
                ", balance=" + balance +
                ", tel=" + tel +
                ", status=" + status +
                ", principal=" + principal +
                ", pwdChange=" + pwdChange +
                ", nameChange=" + nameChange +
                "}";
    }
}
